﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Cost.Models;
using NBlock.MVCControl;

namespace Cost.Controllers
{
    public class StorageRecordViewController : Controller
    {
        #region 构造函数
        private readonly ICostRepository<StorageRecord> storagerecordRepository;

        public StorageRecordViewController(ICostRepository<StorageRecord> storagerecordRepository)
        {
            this.storagerecordRepository = storagerecordRepository;
        }
        #endregion

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public JsonResult List(nbPageInfo pager, nbSearchCondition where)
        {
            var pageData = storagerecordRepository.GetPageable(pager, where);
            var data = pager.ToGridData(pageData);
            return Json(data);
        }
    }
}
